app.controller("census",function($scope,$uibModal,$rootScope,del,$state,get,$stateParams ){
	get.list("staff/age").then(function(e){
		$scope.lineOptionsage = {
			    tooltip : {
			        trigger: 'item',
			        formatter: "{b} : {c} ({d}%)"
			    },
			    legend: {
			        // orient: 'vertical',
			        // top: 'middle',
			        bottom: 10,
			        left: 'center',
			        data:e.type
			    },
			    series : [
			        {
			            type: 'pie',
			            radius : '65%',
			            center: ['50%', '50%'],
			            selectedMode: 'single',
			            data:e.staffEchar,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(0, 0, 0, 0.5)'
			                }
			            }
			        }
			    ]
			};
	})
	get.list("staff/position").then(function(e){
		$scope.lineOptionsposition = {
			    tooltip : {
			        trigger: 'item',
			        formatter: "{b} : {c} ({d}%)"
			    },
			    legend: {
			        // orient: 'vertical',
			        // top: 'middle',
			        bottom: 10,
			        left: 'center',
			        data:e.type
			    },
			    series : [
			        {
			            type: 'pie',
			            radius : '65%',
			            center: ['50%', '50%'],
			            selectedMode: 'single',
			            data:e.staffEchar,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(0, 0, 0, 0.5)'
			                }
			            }
			        }
			    ]
			};
	})
	get.list("staff/job").then(function(e){
		$scope.lineOptionsjob = {
			    tooltip : {
			        trigger: 'item',
			        formatter: "{b} : {c} ({d}%)"
			    },
			    legend: {
			        // orient: 'vertical',
			        // top: 'middle',
			        bottom: 10,
			        left: 'center',
			        data:e.type
			    },
			    series : [
			        {
			            type: 'pie',
			            radius : '65%',
			            center: ['50%', '50%'],
			            selectedMode: 'single',
			            data:e.staffEchar,
			            itemStyle: {
			                emphasis: {
			                    shadowBlur: 10,
			                    shadowOffsetX: 0,
			                    shadowColor: 'rgba(0, 0, 0, 0.5)'
			                }
			            }
			        }
			    ]
			};
	})
	get.list("staff/depart").then(function(e){
		 $scope.lineOption = e
							
	})
	
		get.list("dictionary/serviceDic").then(function(e){
		$scope.serviceDic = e
		$scope.serviceDic.unshift({
			diName:"全部",
			diId:null
		})
		$scope.slect={
			value:{
				diName:"全部",
				diId:null
			}
		}
	})	
	$scope.add={}
	$scope.search=function(i){
		$scope.param={
			pageNum:i||'1',
			pageSize:10,
			key:$scope.key||null
		}
		console.log($scope.add.did)
		if($scope.add.did!=null){
			$scope.param.did=$scope.add.did.diId
		}
		if($scope.add.status!=null){
			$scope.param.status=$scope.add.status.diId
		}
		
		
		get.list("staff/tall",$scope.param).then(function(e){
			$scope.list=e.list
			console.log(e.list)
			$scope.pageSize = e.pageSize; //每页多少条
			$scope.totalNum = e.pageCount; //总共多少页
			$scope.totalSize =e.totalNums; //总共多少条   
			$scope.pageNum = e.pageNum; //当前页面
			/*
				
	*/
		})
		
   	
		
	}


	$scope.pageUp=function(){//跳转页码
       	if ($scope.tj.page>$scope.totalNum) {
       		$scope.tj.page=$scope.totalNum
       	} else if($scope.tj.page<1){
       	$scope.tj.page=null
       	}
       }//pageUp
   $scope.toPage=function(i){//点击跳转
       i=i||$scope.tj.page
       	$scope.search(i)
       	$scope.tj.current=$scope.tj.page;//页码调整
   }//toPage
   if($stateParams.page!=null){
			$scope.tj={
				page:$stateParams.page
			}
		 $scope.toPage($stateParams.page)
	}else{
			$scope.search();
	}
  		$scope.lineConfig = {
	            theme:'macarons',
	            dataLoaded:true
	        };
	        
	$scope.execl=function(){
		$scope.key=$scope.key||null
		if($scope.add.did!=null){
			$scope.param.did=$scope.add.did.diId
		}
		if($scope.add.status!=null){
			$scope.param.status=$scope.add.status.diId
		}
		console.log("/staff/execl?key="+$scope.key+"&did="+$scope.param.did+"&status="+$scope.param.status)
		window.open(localStorage.getItem("Url")+"/staff/execl?key="+$scope.key+"&did="+$scope.param.did+"&status="+$scope.param.status)
		
	}
		

})
